package com.tvunetworks.center.device.model;

import com.tvunetworks.center.gs.model.Device;

import java.io.Serializable;
import java.util.Comparator;

/**
 * @author Etan Yang
 * @create: 2021/10/13 16:04
 */
public class ComparatorName implements Comparator<Device>,Serializable{
	private static final long serialVersionUID = -7411132073037713238L;

	/**
	 *
	 * @param r0 r0
	 * @param r1 r1
	 * @return int
	 */
	public int compare(Device r0, Device r1) {
		
		if (r0 == null || r0.getName() == null) {
			return -1;
		}
		if (r1 == null || r1.getName() == null) {
			return 1;
		}
		
		return r0.getName().compareToIgnoreCase(r1.getName());
	}
}
